#pragma once


#include "Graphics.h"
#include "Sound.h"
#include "GUI_Handler.h"
#include "Input.h"
#include "gamemap.h"
/* Windows Related Function Prototypes */
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
#define SOUND_MANGER "Resources\\scripts\\SoundNames.txt"
enum e_stateOfGame
{
	Menu,
	Loading,
	Playing,

};

struct QueuedEvent
{
	static const int DELETE_BASE_OBJ = 1,
		MESSAGE_BOX_OK = 2;
	int type;
	void * data;
};

class ManageGame
{
private:
	Graphics*	pGraphics;
	Sound		soundMgr;
	HWND OpenWindow(const char* cszWinClassName, const char* cszWindowName, int nCmdShow);
	int m_playersCurrLvl;
	//will load the level you want
	//uses same variables if more add if less release 
	//0 is menu
	void loadLevel(int);
	//loads the level the same 
	void updateLevel();
	//this is if you want a cutscence or something cool going on during each level
	void transition();
	GameMap * pMap;
	TemplateVector<QueuedEvent> m_queue;
public:
	HWND m_hWnd;
	//these are kind of global but I think they good here
	int m_ScreenWidth;
	int m_ScreenHeight;
	ManageGame();
	void createWindow(int);
	void init_allEngines();
	void Update();
	void HandleMessages();
	void RenderGame();
	void Release();
	void initGame();
	Graphics* getGraphics(){return pGraphics;}
	void UpdateSound();
	GameMap * getMap(){return pMap;}
	Sound * getSound(){return &soundMgr;}
	void addEvent(int a_type, void * a_data)
	{
		QueuedEvent qe = {a_type, a_data};
		m_queue.add(qe);
	}
	void doQueue()
	{
		for(int i = 0; i < m_queue.size(); ++i)
		{
			switch(m_queue.get(i).type)
			{
			case QueuedEvent::DELETE_BASE_OBJ:
				delete (BaseObject*)m_queue.get(i).data;
				m_queue.remove(i--);
				break;
			default:
				g_console->Print("Unknown event!");
			}
		}
		//m_queue.clear();
	}
};